渗透工程师常用命令速查手册 |
您所在的位置:网站首页 › ubuntu 删除swap › 渗透工程师常用命令速查手册 |
cat file1 file2 ... | command file1_in.txt_or_file1_out.txt general syntax for text manipulation using PIPE, STDIN and STDOUT cat file1 | command( sed, grep, awk, grep, etc...) > result.txt #合并一个文件的详细说明文本,并将简介写入一个新文件中cat file1 | command( sed, grep, awk, grep, etc...) >> result.txt #合并一个文件的详细说明文本,并将简介写入一个已有的文件中 grep Aug /var/log/messages #在文件 '/var/log/messages'中查找关键词"Aug"grep ^Aug /var/log/messages #在文件 '/var/log/messages'中查找以"Aug"开始的词汇grep [0-9] /var/log/messages #选择 '/var/log/messages' 文件中所有包含数字的行grep Aug -R /var/log/* #在目录 '/var/log' 及随后的目录中搜索字符串"Aug" sed 's/stringa1/stringa2/g' example.txt #将example.txt文件中的 "string1" 替换成 "string2"sed '/^$/d' example.txt #从example.txt文件中删除所有空白行sed '/ *#/d; /^$/d' example.txt #从example.txt文件中删除所有注释和空白行echo 'esempio' | tr '[:lower:]' '[:upper:]' #合并上下单元格内容sed -e '1d' result.txt #从文件example.txt 中排除第一行sed -n '/stringa1/p' #查看只包含词汇 "string1"的行sed -e 's/ *$//' example.txt #删除每一行最后的空白字符sed -e 's/stringa1//g' example.txt #从文档中只删除词汇 "string1" 并保留剩余全部sed -n '1,5p;5q' example.txt #查看从第一行到第5行内容sed -n '5p;5q' example.txt #查看第5行sed -e 's/00*/0/g' example.txt #用单个零替换多个零 cat -n file1 #标示文件的行数cat example.txt | awk 'NR%2==1' #删除example.txt文件中的所有偶数行echo a b c | awk '{print $1}' #查看一行第一栏echo a b c | awk '{print $1,$3}' #查看一行的第一和第三栏paste file1 file2 #合并两个文件或两栏的内容paste -d '+' file1 file2 #合并两个文件或两栏的内容,中间用"+"区分 sort file1 file2 #排序两个文件的内容sort file1 file2 | uniq #取出两个文件的并集(重复的行只保留一份)sort file1 file2 | uniq -u #删除交集,留下其他的行sort file1 file2 | uniq -d #取出两个文件的交集(只留下同时存在于两个文件中的文件) comm -1 file1 file2 #比较两个文件的内容只删除 'file1' 所包含的内容comm -2 file1 file2 #比较两个文件的内容只删除 'file2' 所包含的内容comm -3 file1 file2 #比较两个文件的内容只删除两个文件共有的部分 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |